Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning (not only) in users' code #59

Merged
merged 4 commits into from
Jul 28, 2021
Merged

Conversation

sideeffffect
Copy link
Contributor

Get rid of

pattern var ex in method load is never used: use a wildcard `_` or suppress this warning with `ex@_`
@nativeLoader("adder")
 ^

and similar annoyances.

@pomadchin pomadchin added the fix label Jul 28, 2021
@sideeffffect
Copy link
Contributor Author

Btw, why is the code from NativeLoader not reused in nativeLoaderAnnotationMacro?

@pomadchin
Copy link
Member

pomadchin commented Jul 28, 2021

@sideeffffect that's a great question, the answer is - to make macro annotation a zero dependency case. The way it works: @ compile time the code generated by the nativeLoaderAnnotationMacro is inserted into the body of the class or object.
To use macro annotation, it's enough to have sbt-jni-core as a provided dependency.

However, this is not possible in Scala 3 (no annotations), that's why I implemented this syntax which is close to the original ease of the annotation usage, but requires to have a dependency on the sbt-jni-core project.

See https://github.com/sbt/sbt-jni/blob/main/plugin/src/sbt-test/sbt-jni/simple-syntax/build.sbt#L8

@sideeffffect
Copy link
Contributor Author

But the code in both seems awfully similar. How much opportunity for code reuse/sharing do you think there is?

@pomadchin
Copy link
Member

pomadchin commented Jul 28, 2021

@sideeffffect I don't think there is, we could try to think of smth in Scala 2.x I guess, but def macros also requires a dependency (I checked) 🤷

As time goes we are just going to drop macro annotation / replace it with some future Scala 3 annotations (if there would be any).

I'd like to suggest to keep this old code "as is", just in case it is still useful for users.

@sideeffffect sideeffffect changed the title [WIP] Fix warning (not only) in users' code Fix warning (not only) in users' code Jul 28, 2021
@sideeffffect
Copy link
Contributor Author

OK, let's merge this.
Could you make a release after merge, so that I can use this right away, please?

@pomadchin pomadchin merged commit b78a634 into sbt:main Jul 28, 2021
@sideeffffect sideeffffect deleted the fix-warnings branch July 28, 2021 14:24
@pomadchin
Copy link
Member

@sideeffffect shipped https://github.com/sbt/sbt-jni/actions/runs/1075263499 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants